<html>

<head>
    <title>test</title>
    <script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>

    <script type="text/javascript">
        $(document).ready(function() {
            $("#b01").click(function() {
                htmlobj = $.ajax({
                    url: "http://localhost:9500/jerry_server/login",
                    type: 'POST',
                    data: {
                        username: 'test',
                        password: '123456'
                    },
                    xhrFields: {
                        withCredentials: true // 这里设置了withCredentials
                    },
                });
                $("#myDiv").html(htmlobj.responseText);
            });

            var opt = {
                "condition": {
                    "name": "",
                    "type": null,
                    "state": "1"
                },
                "item": {
                    "id": "",
                    "grandId": "",
                    "typeId": "",
                    "storeId": "",
                    "price": "",
                    "activityId": "",
                    "name": "",
                    "namePy": "",
                    "sellStat": "",
                    "canSellSize": "",
                    "sellSize": "",
                    "size": "",
                    "pic1": "",
                    "pic2": "",
                    "pic3": "",
                    "pic4": "",
                    "pic5": "",
                    "pic6": "",
                    "detail": "",
                    "createTime": ""
                },
                "page": {
                    "pageSize": 50,
                    "pageNo": 1,
                    "totalRows": 0,
                    "sortname": "id",
                    "sortorder": "desc"
                }
            };

            $("#b02").click(function() {
                htmlobj = $.ajax({
                    url: "http://localhost:9500/jerry_server/api/grand/getAll",
                    // url: "http://10.219.11.192:8081/server/test",
                    // contentType: "application/json;charset=utf-8",
                    // dataType: "json",
                    type: 'GET',
                    xhrFields: {
                        withCredentials: true // 这里设置了withCredentials
                    },
                    success: function(data) {
                        console.log(data)
                        $("#myDiv").text(JSON.stringify(data));
                    }
                    // data: JSON.stringify(opt)
                });
                $("#myDiv").html(htmlobj.responseText);
            });
        });
    </script>
</head>

<body>

<div id="myDiv">
    <h2>通过 AJAX 改变文本</h2>
</div>
<button id="b01" type="button">改变内容</button>
<button id="b02" type="button">获取信息</button>

</body>

</html>
